package dao.ejb3;
// Generated 21-mag-2009 14.05.26 by Hibernate Tools 3.2.0.CR1


import h8model.ejb3.Libri;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class Libri.
 * @see h8model.Libri
 * @author Hibernate Tools
 */
@Stateless
public class LibriHome {

    private static final Log log = LogFactory.getLog(LibriHome.class);

    @PersistenceContext private EntityManager entityManager;
    
    public void persist(Libri transientInstance) {
        log.debug("persisting Libri instance");
        try {
            entityManager.persist(transientInstance);
            log.debug("persist successful");
        }
        catch (RuntimeException re) {
            log.error("persist failed", re);
            throw re;
        }
    }
    
    public void remove(Libri persistentInstance) {
        log.debug("removing Libri instance");
        try {
            entityManager.remove(persistentInstance);
            log.debug("remove successful");
        }
        catch (RuntimeException re) {
            log.error("remove failed", re);
            throw re;
        }
    }
    
    public Libri merge(Libri detachedInstance) {
        log.debug("merging Libri instance");
        try {
            Libri result = entityManager.merge(detachedInstance);
            log.debug("merge successful");
            return result;
        }
        catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }
    
    public Libri findById( long id) {
        log.debug("getting Libri instance with id: " + id);
        try {
            Libri instance = entityManager.find(Libri.class, id);
            log.debug("get successful");
            return instance;
        }
        catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
}

